﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ManageDept.aspx.cs" Inherits="WebAddressBook.ManageDept" %>

<%@ Register Src="~/HeaderControl.ascx" TagName="HeaderControl" TagPrefix="uc1" %>
<%@ Register Src="~/CoypyrightControl.ascx" TagName="CoypyrightControl" TagPrefix="uc2"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <link rel="shortcut icon" type="image/png" href="img/favicons/favicon.png" />
    <link rel="icon" type="image/png" href="img/favicons/favicon.png" />
    <link rel="apple-touch-icon" href="img/favicons/apple.png" />
    <!-- Main Stylesheet -->
    <link rel="stylesheet" href="css/style.css" type="text/css" />
    <!-- Colour Schemes
Default colour scheme is blue. Uncomment prefered stylesheet to use it.
<link rel="stylesheet" href="css/brown.css" type="text/css" media="screen" />  
<link rel="stylesheet" href="css/gray.css" type="text/css" media="screen" />  
<link rel="stylesheet" href="css/green.css" type="text/css" media="screen" />
<link rel="stylesheet" href="css/pink.css" type="text/css" media="screen" />  
<link rel="stylesheet" href="css/red.css" type="text/css" media="screen" />
-->
    <!-- Your Custom Stylesheet -->
    <link rel="stylesheet" href="css/custom.css" type="text/css" />
    <!--swfobject - needed only if you require <video> tag support for older browsers -->
    <script type="text/javascript" src="js/swfobject.js"></script>
    <!-- jQuery with plugins -->
    <script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
    <!-- Could be loaded remotely from Google CDN : <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> -->
    <script type="text/javascript" src="js/jquery.ui.core.min.js"></script>
    <script type="text/javascript" src="js/jquery.ui.widget.min.js"></script>
    <script type="text/javascript" src="js/jquery.ui.tabs.min.js"></script>
    <!-- jQuery tooltips -->
    <script type="text/javascript" src="js/jquery.tipTip.min.js"></script>
    <!-- Superfish navigation -->
    <script type="text/javascript" src="js/jquery.superfish.min.js"></script>
    <script type="text/javascript" src="js/jquery.supersubs.min.js"></script>
    <!-- jQuery popup box -->
    <script type="text/javascript" src="js/jquery.nyroModal.pack.js"></script>
    <!-- jQuery form validation -->
    <script type="text/javascript" src="js/jquery.validate_pack.js"></script>
    <!-- Internet Explorer Fixes -->
    <!--[if IE]>
<link rel="stylesheet" type="text/css" media="all" href="css/ie.css"/>
<script src="js/html5.js"></script>
<![endif]-->
    <!--Upgrade MSIE5.5-7 to be compatible with MSIE8: http://ie7-js.googlecode.com/svn/version/2.1(beta3)/IE8.js -->
    <!--[if lt IE 8]>
<script src="js/IE8.js"></script>
<![endif]-->
    <script type="text/javascript">
        $(document).ready(function () {

            /* setup navigation, content boxes, etc... */
            //Administry.setup();

            /* progress bar animations - setting initial values */
            //Administry.progress("#progress1", 1, 6);

            // validate form on keyup and submit
            var validator = $("#sampleform").validate({
                rules: {
                    firstname: "required",
                    lastname: "required",
                    username: {
                        required: true,
                        minlength: 2
                    },
                    password: {
                        required: true,
                        minlength: 5
                    },
                    password_confirm: {
                        required: true,
                        minlength: 5,
                        equalTo: "#password"
                    },
                    email: {
                        required: true,
                        email: true
                    },
                    dateformat: "required",
                    terms: "required"
                },
                messages: {
                    firstname: "Enter your firstname",
                    lastname: "Enter your lastname",
                    username: {
                        required: "Enter a username",
                        minlength: jQuery.format("Enter at least {0} characters")
                    },
                    password: {
                        required: "Provide a password",
                        rangelength: jQuery.format("Enter at least {0} characters")
                    },
                    password_confirm: {
                        required: "Repeat your password",
                        minlength: jQuery.format("Enter at least {0} characters"),
                        equalTo: "Enter the same password as above"
                    },
                    email: {
                        required: "Please enter a valid email address",
                        minlength: "Please enter a valid email address"
                    },
                    dateformat: "Choose your preferred dateformat",
                    terms: " "
                },
                // the errorPlacement has to take the layout into account
                errorPlacement: function (error, element) {
                    error.insertAfter(element.parent().find('label:first'));
                },
                // specifying a submitHandler prevents the default submit, good for the demo
                submitHandler: function () {
                    //我注释掉的
                    //alert("Data submitted!");
                },
                // set new class to error-labels to indicate valid fields
                success: function (label) {
                    // set &nbsp; as text for IE
                    label.html("&nbsp;").addClass("ok");
                }
            });

            // propose username by combining first- and lastname
            $("#username").focus(function () {
                var firstname = $("#firstname").val();
                var lastname = $("#lastname").val();
                if (firstname && lastname && !this.value) {
                    this.value = firstname + "." + lastname;
                }
            });

        });

        function toChangePage() {
            var selectedValue = document.getElementById("LBDeptList");
            var deptid = "";
            for (var i = 0; i < selectedValue.options.length; i++) {
                if (selectedValue.options[i].selected == true) {
                    deptid = selectedValue.options[i].value;
                }
            }
            if (deptid == "") {
                alert("请选中要进行改名的部门!");
                return;
            }
            var url = "UpdateDeptInfo.aspx?deptid=" + deptid + "&rndkey=" + Math.random();
            window.showModalDialog(url, window, 'dialogWidth:600px;dialogHeight:400px;');
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <!-- Header -->
        <div>
            <uc1:HeaderControl ID="HeaderControl1" runat="server" />
        </div>
        <!-- End of Header -->
        <!-- Page title -->
        <div id="pagetitle">
            <div class="wrapper">
                <h1>
                    部门管理</h1>
                <!-- Quick search box -->
            </div>
        </div>
    </div>
    <div id="page">
        <!-- Wrapper -->
        <div class="wrapper">
            <!-- Left column/section -->
            <section class="column full first">
               <div>				
				<fieldset>
				<legend>创建部门</legend>
                  <p>
                  <label class="required" for="DDLEnterprise">所属企业:</label><br/>
                  <asp:DropDownList ID="DDLEnterprise" class="half" runat="server" 
                          AutoPostBack="True" onselectedindexchanged="DDLEnterprise_SelectedIndexChanged"></asp:DropDownList>
                  </p>
                  <p>
                  <label class="required" for="DDLFatherDept">所属上级部门:</label><br/>
                  <asp:DropDownList ID="DDLFatherDept" class="half" runat="server"></asp:DropDownList>
                  </p>
				  <p>
				  <label class="required" for="deptName">部门名称:</label><br/>
				  <input type="text" id="deptName" class="half" runat="server" value="" name="deptName"/>
				 </p>

                 <p>
                 <label class="required" for="deptShortName">部门简称:</label><br/>
                 <input type="text" id="deptShortName" class="half" runat="server" value="" name="deptShortName"/>
                 </p>

                 <p>
                 <label class="required" for="deptPinYin">部门拼音代码:</label><br/>
                 <input type="text" id="deptPinYin" class="half" runat="server" value="" name="deptPinYin"/>
                 </p>

                 <p>
                 <label class="required" for="isWorkAddress">是否办公地点:</label><br/>
                 <p />
                 <asp:RadioButtonList ID="isWorkAddress" runat="server" RepeatDirection="Horizontal">
                 <asp:ListItem Selected="True" Value="True">是</asp:ListItem>
                 <asp:ListItem Value="false">否</asp:ListItem>
                 </asp:RadioButtonList>
                 </p>

                 <p>
                 <label class="required" for="email">办公电话:</label><br/>
                 <input type="text" id="phoneNum" class="half" runat="server" value="" name="phoneNum"/>
                 </p>
                 				
                 <p>
                 <asp:Label ID="LbMessage" runat="server" Text=""></asp:Label>
                 </p>
                 							
                 <p>
                 <asp:Button ID="BtCreate" runat="server" class="btn btn-blue" Text="创建" onclick="BtCreate_Click"></asp:Button>
                 </p>

                 </fieldset>
                 </div>
                 <div class="clear">&nbsp;</div>
                 <div class="box box-info">部门列表</div>
                 <div>
                 <label class="required">选择企业:</label><br />
                 <asp:DropDownList ID="DDLEnterprise2" runat="server" class="half" AutoPostBack="True" 
                  onselectedindexchanged="DDLEnterprise2_SelectedIndexChanged"></asp:DropDownList>
                 <fieldset>
				 <legend>部门列表</legend>
                 <table style="width:100%">
                 <tr>
                 <td>
                 <asp:ListBox ID="LBDeptList" runat="server" class="large full" Height="250px"></asp:ListBox>
                 </td>
                 <td>
                 <table>
                 <tr>
                 <td>
                 <asp:Button ID="BtDelete" runat="server" class="btn btn-blue" Text="删除选中的部门" 
                         onclick="BtDelete_Click"></asp:Button>
                 </td>
                 </tr>
                 <tr>
                 <td style="height:10px">
                 </td>
                 </tr>
                 <tr>
                 <td>
                 <input type="button" class="btn btn-blue" value="更新选中的部门" onclick="toChangePage()" />
                 </td>
                 </tr>
                 </table>
                 </td>
                 </tr>
                 </table>
                 </fieldset>
                 </div>
           </section>
        </div>
        <!-- End of Wrapper -->
        <!-- End of Page content -->
    </div>
    <!-- Page footer -->
    <div>
        <uc2:CoypyrightControl ID="CoypyrightControl1" runat="server" />
    </div>
    <!--End Page footer -->
    </form>
</body>
</html>
